/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bibliinfo;

import configuracao.ConfigFrame;
import emprestimo.frames.LoanFrameCad;
import emprestimo.frames.LoanFrameMain;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JInternalFrame;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import lista.ListFrame;
import livro.frames.BookFrameAltera;
import livro.frames.BookFrameCad;
import livro.frames.BookFrameMain;
import log.LogFrame;
import relatorio.RelFrame;
import usuario.frames.UserFrameDados;
import usuario.frames.UserFrameMain;
import usuario.frames.UserFrameDadosAdicional;

/**
 *
 * @author Ar0n
 */
public class FrameMain extends javax.swing.JFrame {    
    
    public FrameMain() {
        initComponents();
        
        setIcon();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jTBEmp = new javax.swing.JToggleButton();
        jTBUser = new javax.swing.JToggleButton();
        jTBBook = new javax.swing.JToggleButton();
        jTBRela = new javax.swing.JToggleButton();
        jTBList = new javax.swing.JToggleButton();
        jTBConf = new javax.swing.JToggleButton();
        jTBLog = new javax.swing.JToggleButton();
        jDesktop = new javax.swing.JDesktopPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("InfoBiblio");
        setBounds(new java.awt.Rectangle(0, 0, 900, 600));
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(0, 0, 0));
        jPanel1.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                jPanel1AncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        jTBEmp.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBEmp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_emp/1365269231_interact.png"))); // NOI18N
        jTBEmp.setText("Empréstimo");
        jTBEmp.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBEmp.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBEmp.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBEmp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBEmpActionPerformed(evt);
            }
        });

        jTBUser.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_user/1365267614_group.png"))); // NOI18N
        jTBUser.setSelected(true);
        jTBUser.setText("Usuário");
        jTBUser.setBorderPainted(false);
        jTBUser.setDoubleBuffered(true);
        jTBUser.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBUser.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBUser.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBUserActionPerformed(evt);
            }
        });

        jTBBook.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBBook.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_livro/1365267550_books.png"))); // NOI18N
        jTBBook.setText("Livro");
        jTBBook.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBBook.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBBook.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBBook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBBookActionPerformed(evt);
            }
        });

        jTBRela.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBRela.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_rel/1365268081_fusion_tables.png"))); // NOI18N
        jTBRela.setText("Relatório");
        jTBRela.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBRela.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBRela.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBRela.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBRelaActionPerformed(evt);
            }
        });

        jTBList.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBList.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_lista/1365267869_application-sidebar-list.png"))); // NOI18N
        jTBList.setText("Lista");
        jTBList.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBList.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBList.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBListActionPerformed(evt);
            }
        });

        jTBConf.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTBConf.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_conf/1365269334_cog.png"))); // NOI18N
        jTBConf.setText("Configuração");
        jTBConf.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTBConf.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBConf.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jTBConf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBConfActionPerformed(evt);
            }
        });

        jTBLog.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jTBLog.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/img_log/1365268551_gtk-quit.png"))); // NOI18N
        jTBLog.setText("Sair");
        jTBLog.setPreferredSize(new java.awt.Dimension(100, 100));
        jTBLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTBLogActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTBList, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBUser, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBEmp, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBRela, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBConf, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBBook, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTBLog, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTBUser, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTBBook, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTBList, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTBEmp, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTBRela, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jTBConf, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
                .addComponent(jTBLog, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jDesktop.setBackground(new java.awt.Color(240, 240, 240));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jDesktop, javax.swing.GroupLayout.DEFAULT_SIZE, 814, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jDesktop)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jTBUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBUserActionPerformed
               
       //Adequando funcionamento dos botões do menu        
      userFrameAdd.setVisible(false);
      userFrameAdd.setEstado(false);
      
      userFrameDados.setVisible(false);
      userFrameDados.setEstado(false);
      
      bookFrameMain.setVisible(false);      
      bookFrameMain.setEstado(false);
      
      bookFrameCad.setVisible(false);
      bookFrameCad.setEstado(false);
      
      bookFrameAltera.setVisible(false);
      bookFrameAltera.setEstado(false);
      
      loanFrameMain.setVisible(false);
      loanFrameMain.setEstado(false);
      
      loanFrameCad.setVisible(false);
      loanFrameCad.setEstado(false);
      alteraBotoes(1);
      
      //InternalJFrame
      //if(userFrameMain.getEstado() == false){
        userFrameMain.setVisible(true);
        userFrameMain.setEstado(true);  
        formata(11);
      //}
      
      
      //formata(11);
    }//GEN-LAST:event_jTBUserActionPerformed

    private void jTBBookActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBBookActionPerformed
        
        //usuário
        userFrameMain.setVisible(false);
        userFrameMain.setEstado(false);
        
        userFrameDados.setVisible(false);
        userFrameDados.setEstado(false);
        
        userFrameAdd.setVisible(false);
        userFrameAdd.setEstado(false);
        
        //livro
        bookFrameCad.setVisible(false);
        bookFrameCad.setEstado(false);
        
        bookFrameAltera.setVisible(false);
        bookFrameAltera.setEstado(false);
        
        loanFrameMain.setVisible(false);
        loanFrameMain.setEstado(false);
        
        loanFrameCad.setVisible(false);
        loanFrameCad.setEstado(false);
        
        bookFrameMain.setVisible(true);
        bookFrameMain.setEstado(true);
        mapa.put("frame21", bookFrameMain);
        formata(21);
        //Adequando funcionamento dos botões do menu        
        alteraBotoes(2);     
    }//GEN-LAST:event_jTBBookActionPerformed

    private void jTBListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBListActionPerformed
        //Adequando funcionamento dos botões do menu        
        listFrame.setVisible(true);
        //Adequando funcionamento dos botões do menu        
        alteraBotoes(3);   
    }//GEN-LAST:event_jTBListActionPerformed

    private void jTBEmpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBEmpActionPerformed
        
        userFrameMain.setVisible(false);
        userFrameMain.setEstado(false);
        
        userFrameAdd.setVisible(false);
        userFrameAdd.setEstado(false);

        userFrameDados.setVisible(false);
        userFrameDados.setEstado(false);

        bookFrameMain.setVisible(false);      
        bookFrameMain.setEstado(false);

        bookFrameCad.setVisible(false);
        bookFrameCad.setEstado(false);

        bookFrameAltera.setVisible(false);
        bookFrameAltera.setEstado(false);
      
        loanFrameMain.setVisible(true);
        loanFrameMain.setEstado(true);        

        loanFrameCad.setVisible(false);
        loanFrameCad.setEstado(false);
        
        formata(41);
        //Adequando funcionamento dos botões do menu        
        alteraBotoes(4); 
    }//GEN-LAST:event_jTBEmpActionPerformed

    private void jTBRelaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBRelaActionPerformed
        relFrame.setVisible(true);
        //Adequando funcionamento dos botões do menu        
        alteraBotoes(5);  
    }//GEN-LAST:event_jTBRelaActionPerformed

    private void jTBConfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBConfActionPerformed
        configFrame.setVisible(true);
        //Adequando funcionamento dos botões do menu        
        alteraBotoes(6);  
    }//GEN-LAST:event_jTBConfActionPerformed

    private void jTBLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTBLogActionPerformed
        this.dispose();
        FrameLogin login = new FrameLogin();
        login.setVisible(true);
        login.setLocationRelativeTo(null);
    }//GEN-LAST:event_jTBLogActionPerformed

    /**
     Evento lançado pelo painel principal para encapsular meus frames
     */    
    private void jPanel1AncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_jPanel1AncestorAdded
       
        //frames relacionados a usuario   
       userFrameMain = new UserFrameMain();           
       jDesktop.add(userFrameMain);            
       userFrameMain.setVisible(true);
       userFrameMain.setEstado(true);        
       userFrameMain.pesquisarNome(true);
       
       //retirando bordas do internalJframe           
       this.mapa.put("frame11", userFrameMain);
       formata(11);           
       
       userFrameDados = new UserFrameDados();
       jDesktop.add(userFrameDados);
       this.mapa.put("frame12", userFrameDados);              
       userFrameDados.setVisible(false);
       userFrameDados.setEstado(false);       
       
       userFrameAdd = new UserFrameDadosAdicional();
       jDesktop.add(userFrameAdd);
       this.mapa.put("frame13", userFrameMain);              
       userFrameAdd.setVisible(false);
       userFrameAdd.setEstado(false);              
       /**
        Esta parte é adicionada aqui para que o botão de excluir possa ser manipulado
        */
       userFrameAdd.jDesktopExcluir.add(userFrameAdd.jBrestaurar);
       userFrameAdd.jDesktopExcluir.add(userFrameAdd.jBexcluir);
       
       
       //frames relacionados a livros
       bookFrameMain = new BookFrameMain();
       jDesktop.add(bookFrameMain);
       this.mapa.put("frame21", bookFrameMain);
       bookFrameMain.setVisible(false);
       bookFrameMain.setEstado(false);
       bookFrameMain.pesquisar();
       
       bookFrameCad = new BookFrameCad();
       jDesktop.add(bookFrameCad);
       this.mapa.put("frame22", bookFrameCad);
       bookFrameCad.setVisible(false);
       bookFrameCad.setEstado(false);
       
       bookFrameAltera = new BookFrameAltera();
       jDesktop.add(bookFrameAltera);
       this.mapa.put("frame23", bookFrameAltera);       
       bookFrameAltera.setVisible(false);
       bookFrameAltera.setEstado(false);
       /**
        Esta parte é adicionada aqui para que o botão de excluir possa ser manipulado
        */
       bookFrameAltera.jDesktopExcluir.add(bookFrameAltera.jBRestaurar);
       bookFrameAltera.jDesktopExcluir.add(bookFrameAltera.jBExcluir);
       
       //frames relacionados a lista de espera
       listFrame = new ListFrame();
       jDesktop.add(listFrame);
       
       //frames relacionados a emprestimos
       loanFrameMain = new LoanFrameMain();
       jDesktop.add(loanFrameMain);
       this.mapa.put("frame41", loanFrameMain);
       loanFrameMain.setVisible(false);
       loanFrameMain.setEstado(false);
       
       loanFrameCad = new LoanFrameCad();
       jDesktop.add(loanFrameCad);
       this.mapa.put("frame42", loanFrameCad);
       loanFrameCad.setVisible(false);
//       /loanFrame.sete
       
       
       //frames relacionados a relatórios
       relFrame = new RelFrame();
       jDesktop.add(relFrame);
       
       //frames relacionados a configuraçoes
       configFrame = new ConfigFrame();
       jDesktop.add(configFrame);
       
       //frames relacionados com login
       logFrame = new LogFrame();
       jDesktop.add(logFrame);
    }//GEN-LAST:event_jPanel1AncestorAdded

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FrameMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FrameMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FrameMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FrameMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */        
        java.awt.EventQueue.invokeLater(new Runnable() {            
            public void run() {
                FrameMain frame = new FrameMain();
                frame.setVisible(true);
                frame.setLocationRelativeTo(null);       
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JDesktopPane jDesktop;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToggleButton jTBBook;
    private javax.swing.JToggleButton jTBConf;
    private javax.swing.JToggleButton jTBEmp;
    private javax.swing.JToggleButton jTBList;
    private javax.swing.JToggleButton jTBLog;
    private javax.swing.JToggleButton jTBRela;
    private javax.swing.JToggleButton jTBUser;
    // End of variables declaration//GEN-END:variables
    
    //Atributos
    //frames contidos no jdesktop
    public static UserFrameMain userFrameMain = null;
    public static UserFrameDados userFrameDados = null;
    public static UserFrameDadosAdicional userFrameAdd = null;
    
    public static BookFrameMain bookFrameMain = null;
    public static BookFrameCad bookFrameCad = null;    
    public static BookFrameAltera bookFrameAltera = null;    
    
    public static LoanFrameMain loanFrameMain = null;
    public static LoanFrameCad loanFrameCad = null;
    
    public static ListFrame listFrame = null;
    
    public static RelFrame relFrame = null;
    public static ConfigFrame configFrame = null;
    public static LogFrame logFrame = null;    
    //mapa para se usar o método que formata o frame
    public static Map <String, JInternalFrame> mapa = new HashMap<String, JInternalFrame>();
    
    //métodos
    public void alteraBotoes(int i){
        if(i == 1){
            jTBUser.setSelected(true);
            jTBBook.setSelected(false);
            jTBList.setSelected(false);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(false);
            jTBConf.setSelected(false);
            jTBLog.setSelected(false);
        }else if(i == 2){
            jTBUser.setSelected(false);
            jTBBook.setSelected(true);
            jTBList.setSelected(false);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(false);
            jTBConf.setSelected(false);
            jTBLog.setSelected(false); 
        }else if(i == 3){
             jTBUser.setSelected(false);
            jTBBook.setSelected(false);
            jTBList.setSelected(true);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(false);
            jTBConf.setSelected(false);
            jTBLog.setSelected(false);   
        }else if(i == 4){
            jTBUser.setSelected(false);
            jTBBook.setSelected(false);
            jTBList.setSelected(false);
            jTBEmp.setSelected(true);
            jTBRela.setSelected(false);
            jTBConf.setSelected(false);
            jTBLog.setSelected(false); 
        }else if(i == 5){
            jTBUser.setSelected(false);
            jTBBook.setSelected(false);
            jTBList.setSelected(false);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(true);
            jTBConf.setSelected(false);
            jTBLog.setSelected(false);
        }else if(i == 6){
            jTBUser.setSelected(false);
            jTBBook.setSelected(false);
            jTBList.setSelected(false);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(false);
            jTBConf.setSelected(true);
            jTBLog.setSelected(false);
        }else if(i == 7){
            jTBUser.setSelected(false);
            jTBBook.setSelected(false);
            jTBList.setSelected(false);
            jTBEmp.setSelected(false);
            jTBRela.setSelected(false);
            jTBConf.setSelected(false);
            jTBLog.setSelected(true); 
        }
    }
    /**
     Método usado para formata as janelas da meneira adequada
     */
    public static void formata(int a){
        
       //retirando bordas do internalJframe           
       ((BasicInternalFrameUI)mapa.get("frame"+a).getUI()).setNorthPane(null);
       mapa.get("frame"+a).setBorder(null);        
       //pegando dimenções do JFrame no qual ele esta encapsulado
       mapa.get("frame"+a).setBounds(0, 0, jDesktop.getWidth(), jDesktop.getHeight());        
       mapa.get("frame"+a).setResizable(false);
       mapa.get("frame"+a).setBorder(null);  
    }

    private void setIcon() {
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("livro.png")));
    }
}
